<?php


namespace app\api\model;


use think\Model;

class UserSportModel extends Model
{

    // 表名
    protected $name = 'user_sport';

    // 自动写入时间戳字段
    protected $autoWriteTimestamp = 'int';

    // 定义时间戳字段名
    protected $createTime = 'createtime';
    protected $updateTime = false;
    protected $deleteTime = false;

    protected $append = ['starttime_text','endtime_text'];


    public function getStarttimeTextAttr($val,$data)
    {
        return date('Y-m-d H:i',$data['starttime']);
    }

    public function getEndtimeTextAttr($val,$data)
    {
        return date('Y-m-d H:i',$data['endtime']);
    }
}